<template>
 <div>
  <refCom></refCom>
  <p v-if="flag" ref="dom">黑马程序员</p>
  <button @click="change">按钮</button>
  <input type="text" ref="iref">
 </div>
</template>
<script>
import { onMounted } from 'vue';
import refCom from './ref/refCom.vue';
export default{
  components:{
    refCom
  },
    data () {
        return {
            flag:false
        }
    },
    created () {
    },
    computed:{
    },
    methods:{
        change(){
          this.flag = !this.flag
          console.log(this.$refs.dom);
        }
    },
    mounted(){
       this.$refs.iref.focus()
    }
}
</script>
<style lang='less'  scoped>
    
</style>
